package com.solo.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/*
 * FileName: PostService.java
 * Description: 帖子服务 - 使用注解注入
 * Author:   woolflighthouse@163.com
 * Date:     2025-11-19 17:41
 */
@Service
public class PostService {

    // 字段注入（不推荐，但简单易懂）
    @Autowired
    private BlogService blogService;

    public void createPost(String title, String content) {
        System.out.println("发布帖子:");
        System.out.println("  标题: " + title);
        System.out.println("  内容: " + content);
        System.out.println("  发布时间: " + java.time.LocalDateTime.now());

        // 使用注入的blogService记录发布日志
        if (blogService != null) {
            blogService.createBlog("帖子发布记录");
        }
    }
}
